package com.chainyoung.component_tmperson.ui.mvp.model;

import com.chainyoung.common.appcommon.entity.CommonList;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.entity.WalletFinancingOwn;
import com.chainyoung.component_tmperson.entity.WalletProfiRecord;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletFinancingProfitContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletFinancingTradeContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;

public class WalletFinancingProfitModel extends BaseModel implements WalletFinancingProfitContract.Model {


    @Inject
    WalletFinancingProfitModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);

    }


    @Override
    public Flowable<WalletFinancingOwn> getUserFinancingProfit(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getUserFinancingProfit(map)
                .compose(RxUtils.<WalletFinancingOwn>handleResult());
    }

    @Override
    public Flowable<String> turnOut(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .turnOut(map)
                .compose(RxUtils.<String>handleResult());
    }


    @Override
    public Flowable<CommonList<WalletProfiRecord>> getFinancingProfitList(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getFinancingProfitList(map)
                .compose(RxUtils.<CommonList<WalletProfiRecord>>handleResult());
    }

}


